<!--
 * @Author: your name
 * @Date: 2021-03-15 08:53:56
 * @LastEditTime: 2021-03-15 10:32:52
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \Python自然语言处理课堂案例d:\拓晟教育\课堂demo\vue11\day03\01v-if 使用场景.html
-->
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>vue基础语法03</title>
    <script src="./js/vue.js"></script>
  </head>
  <body>
    <!-- 
         v-for 语法结构：遍历数组  
         写法1：
         v-for="item in items"
	              item 是我们自己定义的一个名字  代表数组里面的每一项  
	              items对应的是 data中的数组
        写法2：
         v-for=":(item,index) in items" :key="index"
         key 的作用
          key来给每个节点做一个唯一标识
          key的作用主要是为了高效的更新虚拟DOM

       

     -->
    <div id="app">
      <ul>
        <!-- <li v-for="item in userInfoList">{{item}}</li> -->
        <!--  <li v-for="(item,index) in userInfoList" :key="index">
          {{item}}---{{index}}
        </li> -->

        <li v-for="(item,index) in userInfoList2" :key="index">
          {{item.id}}---{{item.name}}
        </li>

        <li v-for="(item,keys,index) in userInfoList3">
          键名：{{keys}}----- 键值：{{item}}-----索引：{{index}}
        </li>
      </ul>
    </div>
    <script>
      // vue实例化
      new Vue({
        el: "#app", //作用范围
        data: {
          userInfoList: ["张三", "李四", "王五"],
          userInfoList2: [
            { id: 1, name: "张三" },
            { id: 2, name: "李四" },
            { id: 3, name: "王五" }
          ],
          userInfoList3: {
            id: 10,
            name: "李四",
            age: 20
          }
        },
        methods: {}
      });
    </script>
  </body>
</html>
